package com.yifi.system.controller;

import java.io.File;

import com.jfinal.core.Path;
import com.yifi.common.URLCodeUtils;
import com.yifi.common.base.BaseController;
import com.yifi.common.utils.FileUtils;

@Path(value = "common",viewPath = "/")
public class common_controller extends BaseController {

	public void index()
	{
		renderText("hello world!");
	}
	//获取模板文件
	public void download()
	{
		String fileName=getPara("fileName","");
		fileName=URLCodeUtils.decode(fileName);
		boolean delete=getBoolean("delete",false);

		String filePath= FileUtils.getDownDir()+fileName;
		
		renderFile(new File(filePath));
	}
	//下载生成的文件
	public void downloadExp()
	{
		String fileName=getPara("fileName","");
		fileName=URLCodeUtils.decode(fileName);
		boolean delete=getBoolean("delete",false);

		//String filePath= FileUtils.getDownDir()+fileName;		
		String filePath = getRequest().getSession().getServletContext().getRealPath("/impTemp/" + fileName);

		renderFile(new File(filePath));
	}
}
